package com.chenjiagou.service.impl;


import com.chenjiagou.mapper.NotificationMapper;
import com.chenjiagou.pojo.Notification;
import com.chenjiagou.service.NotificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NotificationServiceImpl implements NotificationService {

    @Autowired
    private NotificationMapper notificationMapper;


    @Override
    public void insertUserNotification(int userId, int notificationId) {

        notificationMapper.insertUserNotification(userId, notificationId);

    }

    @Override
    public List<Notification> findNotificationByUserId(int userId) {
        return notificationMapper.findNotificationByUserId(userId);
    }

    @Override
    public List<Notification> findUnreadByUserId(int userId) {
        return notificationMapper.findUnreadByUserId(userId);
    }
    @Override
    public void deleteNotification(int id) {
        notificationMapper.deleteNotificationById(id);
    }


    @Override
    public void publishNotification(int flightId, String title, String content) {
        notificationMapper.publishNotification(flightId, title, content);
    }


}
